﻿using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
using PlanetTelex.RssViewer.Models;

namespace PlanetTelex.RssViewer {
    public class Migrations : DataMigrationImpl {
        public int Create() {

            ContentDefinitionManager.AlterPartDefinition(typeof (RssViewerPart).Name, part => part
                .Attachable()
                .WithDescription("Displays an RSS Feed"));

            ContentDefinitionManager.AlterTypeDefinition(
                "RssViewerWidget",
                cfg => cfg
                           .WithPart("RssViewerPart")
                           .WithPart("CommonPart")
                           .WithPart("WidgetPart")
                           .WithSetting("Stereotype", "Widget")
                );
            return 1;
        }
    }
}